docs(prd): 0009 — keep the herd alive (persistent agent runtime) - #341
Merged
Conversation
…ol surface Ports the ideas behind herdr.dev into moshcode: a background runtime that owns the terminals so sessions survive the pit, semantic agent state (idle/working/blocked/done/unknown) with one status authority per session, and a single CLI surface both humans and agents drive. Deliberately does not port herdr's implementation — no Rust binary, no multiplexer UI, no pane-plugin marketplace. Leans on the tmux that tabs.mjs already reaches for, keeps pty.mjs's capability-detection discipline, and routes "blocked" into the existing notify()/ask() fan-out, which is the part herdr structurally cannot do. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan91 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 41 | LOW: 48
…and 41 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
ralyodio
marked this pull request as ready for review
August 9, 2026 15:46
Merged
ralyodio
added a commit
that referenced
this pull request
Aug 9, 2026
Bump to v0.33.0, releasing the herd (#342) — agent sessions that outlive the terminal that started them — along with the PRD behind it (#341) and the moshpit pinned-TLS proxy fix (#343), all of which have been sitting on main unreleased. Minor rather than patch: #342 adds six commands (herd, ps, attach, kill, wait, restore) and six moshscript verbs, and changes none of the existing ones. `moshcode start claude` with no -d behaves exactly as it did. This release is what makes any of it reachable. install.sh serves the latest release tarball rather than main, so until a release carries it every installed machine answers `unknown command "ps"` — and the npm channel only moves when publish.yml sees a published GitHub release. No plugin bumps: stocks and crypto are untouched, and neither names a command that moved. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
prd/0009-persistent-agent-runtime.md— a PRD for adopting the ideas behind herdr.dev into moshcode, filtered for what actually fits this codebase.What herdr gets right, and what's worth taking
herdr's core inversion is "a server owns the terminals; every UI is a client of it." Terminals live in a background server, panes carry semantic agent state (
idle/working/blocked/done), and the CLI and socket API are one surface so agents drive it the same way people do.That inversion is the idea. The implementation — a 10MB Rust multiplexer with mouse drag, pane splits, and a plugin marketplace — is not.
The gaps it exposes here
openPassthroughties every session to the terminal that started it.tabs.mjsreaches for tmux but keys the server to the pit's pid (moshcode-${pid}-${stamp}), so tabs are as mortal as the pit.mirror.mjsdocuments its own blind spot — once an engine takes the terminal, the browser watches a pit that stopped saying anything.pty.mjswas built to fix this and isn't load-bearing yet.Shape of the proposal
Three independently shippable phases:
attach/detach/ps/kill. Bulk of the value, zero state detection required.blockedrouted into the existingnotify()/ask()fan-out.moshcode agent start|prompt|read|send-keys|wait|stop, all--json, all exposed as moshscript verbs;pty.mjscloses the mirror blind spot and ttyd attaches to a real session.The
blocked→ notify path is the part herdr structurally can't do: it can colour a pane, moshcode can text you and type the answer back.Explicit non-goals
No Rust binary or compiler in the install path (
pty.mjsalready rejected node-pty for exactly this reason). No pane splits, mouse drag, or theme engine. No second plugin system. No Windows. tmux stays a soft dependency with a tested fallback to today's foreground passthrough.Sanity check
node --test test/prd.test.mjs test/prd-index-cell.test.mjs test/tui-prd-errors.test.mjs— 39 pass, 0 fail. The README index was regenerated withregenerateIndex()rather than hand-edited.🤖 Generated with Claude Code